import { _decorator, Component, director, game, Label, Node } from 'cc';
import { eventDispatcher } from './eventDispatcher';
import { gameState } from './gameState';
const { ccclass, property } = _decorator;

@ccclass('pageOverAction')
export class pageOverAction extends Component {
    @property(Label) challenge_label:Label = null;
    start() {
        this.node.active = false;
        eventDispatcher.get_target().on(eventDispatcher.OPEN_OVER,this.open_page,this);
    
    }
    open_page(){
        this.node.active = true;
        this.challenge_label.string = "X"+gameState.cur_lvl;
    }
    click_replay(){
        this.node.active = false;
        eventDispatcher.get_target().emit(eventDispatcher.REPLAY_GAME);
    }
    click_back(){
        this.node.active = false;
        director.loadScene("home");
    }
    update(deltaTime: number) {
        
    }
}


